package com.zxn.project.config;


import com.zxn.project.interceptor.WxInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebAppConfig implements WebMvcConfigurer {

    @Bean
    public WxInterceptor wxInterceptor(){
        return new WxInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        String[] patters=new String[]{"/user/login"};
        registry.addInterceptor(wxInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns(patters);
    }
}
